let mysql = require('mysql');
let sql = 'SELECT * FROM user WHERE name="zt"';
let connection = mysql.createConnection({
  host: 'localhost',
  user: 'root',
  password: 'zt4945327',
  database: 'test',
});

connection.connect();
connection.query(sql, (err, results,fields) => {
  if (err) {
    console.log(err);
  } else {
    console.log('yes');
    if (results.length > 0) {
      console.log(results[0].pass)
    } else {
      console.log(0)
    }
  }
});
connection.end();